package com.D5Power.Render
{
	import com.D5Power.Objects.Effects.BulletObject;
	import com.D5Power.Objects.Effects.EffectObject;
	import com.D5Power.Objects.GameObject;
	
	import flash.geom.ColorTransform;
	import flash.geom.Point;


	/**
	 * 效果渲染器
	 */ 
	public class RenderEffect extends Render
	{
		public function RenderEffect()
		{
			super();
		}
		
		override public function render(o:GameObject):void
		{
			var m:EffectObject = o as EffectObject;
			
			if(m.graphics==null) return;
			
			var p:Point = m.Scene.Map.getScreenPostion(m.Pos.x,m.Pos.y);
			switch(m.renderPos)
			{
				case GameObject.CENTER:
					p.x-=m.graphics.frameWidth/2;
					p.y-=m.graphics.frameHeight/2;
					break;
				case GameObject.BOTTOM:
					p.x-=m.graphics.frameWidth/2;
					p.y-=m.graphics.frameHeight;
					break;
			}
			
			renderShadow(o,p);

			p.x+=m.rendFly.x;
			p.y+=m.rendFly.y;
			m.graphics.bitmap.colorTransform(m.graphics.bitmap.rect,m.colorPan);
			draw(m.graphics.bitmap,m.renderRect,p);
		}
	}
}